<div class="row">
	<div class="col-md-12">
		<h1>Danh mục sản phẩm <small>Quản lý các danh mục sản phẩm</small></h1>
		<ol class="breadcrumb">
            <li><a href="<?php echo admin_page_url(); ?>"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li class="active"><i class="fa fa-table"></i> Danh sách các danh mục hiện có</li>
        </ol>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <p class="pull-right">
            <a class="btn btn-success" href="<?php echo admin_page_url(CATEGORY_SLUG.'/'.INSERT_SLUG); ?>"><i class="glyphicon glyphicon-plus-sign"></i> Thêm danh mục</a>
        </p>
    </div>
    <div class="col-md-12">
        <div class="table-responsive">
            <table class="table table-bordered table-hover tablesorter item-list"
                data-href='<?php echo admin_page_url(CATEGORY_SLUG.'/'.UPDATE_SLUG.'/do'); ?>'
                data-category-url="<?php echo category_url('{replace-slug}'); ?>"
            >
                <thead>
                    <tr>
                        <th class="header"># <i class="fa fa-sort"></i></th>
                        <th class="header">Hình đại diện</th>
                        <th class="header">Tên danh mục / Đường dẫn <i class="fa fa-sort"></i></th>
                        <th class="header">Thứ tự <i class="fa fa-sort"></i></th>
                        <th class="header">Hiển thị</th>
                    </tr>
                    <tr class="tr-temp hidden warning">
                        <td colspan="7">
                            <form role="form" method="post" data-callback="1">
                                <div class="row">
                                    <div class="col-md-7">
                                        <div class="form-group col-md-12 col-xs-12">
                                            <label for="input-category-title">Tên danh mục</label>
                                            <input type="text" class="form-control auto-slug" follow-ctr='#input-category-slug'  id="input-category-title" name="category[title]" />
                                        </div>
                                        <div class="form-group col-md-12 col-xs-12">
                                            <label for="input-category-slug">Đường dẫn</label>
                                            <input type="text" class="form-control" id="input-category-slug" name="category[slug]" />
                                        </div>
                                        <div class="form-group col-md-4 col-xs-12">
                                            <label for="input-category-order">Thứ tự</label>
                                            <input type="text" class="form-control" id="input-category-order" name="category[order]" />
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="col-md-5">
                                        <div class="checkbox">
                                            <label for="input-category-delete-flg">
                                                <input type="checkbox" id="input-category-delete-flg" name="category[publish_flg]" value="1"/> Hiển thị
                                            </label>
                                        </div>
                                        <p>
                                            <input type="hidden" name="category[id]" id="input-category-id" />
                                            <button type="button" class="btn btn-success btn-submit-update"><i class="glyphicon glyphicon-ok-sign"></i> Cập nhật</button>
                                            <button type="button" class="btn btn-danger btn-cancel-update"><i class="glyphicon glyphicon-remove-sign"></i> Huỷ</button>
                                        </p>
                                    </div>
                                </div>
                            </form>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($aCate as $index=>$tCate) { ?>
                    <tr class="can-edit" data-id="<?php echo $this->encrypt->encode($tCate->getId()); ?>">
                        <th class="header bg-info"><?php echo $index+1; ?></th>
                        <td class="col-md-1 col-xs-12">
                            <div class="media">
                                <a class="thumbnail fancybox" href="<?php echo upload(CATEGORY_IMAGE_URL.$tCate->getIcon(), false); ?>">
                                <?php if($tCate->getIcon()!='') { ?>
                                <img class="media-object" src="<?php echo upload(CATEGORY_IMAGE_URL.$tCate->getIcon()); ?>" />
                                <?php } else { ?>
                                <img class="media-object" data-src="holder.js/100%x50" />
                                <?php } ?>
                                </a>
                            </div>
                            <p class="text-center">
                                <a class="input-category-slug btn btn-success" data-slug="<?php echo $tCate->getSlug(); ?>" href="<?php echo category_url($tCate->getSlug()); ?>"><i class="fa fa-external-link"></i> Xem</a>
                            </p>
                        </td>
                        <td>
                            <a class="input-category-title strong big-title" href="<?php echo admin_category_url($tCate->getSlug()); ?>">
                                <?php echo $tCate->getTitle(); ?>
                            </a>
                        </td>
                        <td class="input-category-order strong"><?php echo $tCate->getOrder(); ?></td>
                        <td class="input-category-delete-flg">
                            <input id="chk-del-<?php echo $index+1; ?>" class="checkbox lb-toggle" data-name="publish_flg" type="checkbox" <?php echo ($tCate->getDeletedAt())==NULL?"checked='checked'":''; ?> />
                            <label for="chk-del-<?php echo $index+1; ?>"></label>
                        </td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="clearfix"></div>
</div>